package org.linlinjava.litemall.admin.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.linlinjava.litemall.admin.beans.annotation.LogAnno;
import org.linlinjava.litemall.admin.service.AdminLumiereFormulaSpecificationsDataProportioningService;
import org.linlinjava.litemall.admin.vo.formulamaterial.FormulaSpecificationsDataProportioningReqVO;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.LumiereFormulaSpecificationsDataProportioning;
import org.springframework.web.bind.annotation.*;

@Api(tags = "配方规格数据配比管理API")
@RestController
@RequestMapping("admin/formulaSpecificationsDataProportioning")
@RequiredArgsConstructor
public class AdminLumiereFormulaSpecificationsDataProportioningController {

    private final AdminLumiereFormulaSpecificationsDataProportioningService adminLumiereFormulaSpecificationsDataProportioningService;

    @ApiOperation("配方规格数据配比管理-查询配方规格数据配比列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "limit",value = "数量"),
            @ApiImplicitParam(name = "page",value = "当前页"),
    })
    @LogAnno
    @GetMapping("/list")
    public ResponseUtil.Response list(LumiereFormulaSpecificationsDataProportioning lumiereFormulaSpecificationsDataProportioning) {
        return adminLumiereFormulaSpecificationsDataProportioningService.newListLumiereFormulaSpecificationsDataProportioning(lumiereFormulaSpecificationsDataProportioning);
    }

    @ApiOperation("配方规格数据配比管理-新增配方规格数据配比")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "specificationsName",value = "规格名称"),
    })
    @LogAnno
    @PostMapping("/add")
    public ResponseUtil.Response add(@RequestBody FormulaSpecificationsDataProportioningReqVO lumiereFormulaSpecificationsDataProportioning)  {
        return adminLumiereFormulaSpecificationsDataProportioningService.addLumiereFormulaSpecificationsDataProportioning(lumiereFormulaSpecificationsDataProportioning);
    }

    @ApiOperation("配方规格数据配比管理-编辑配方规格数据配比")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "specificationsName",value = "规格名称"),
    })
    @LogAnno
    @PutMapping ("/update")
    public ResponseUtil.Response update(@RequestBody LumiereFormulaSpecificationsDataProportioning lumiereFormulaSpecificationsDataProportioning)  {
        return adminLumiereFormulaSpecificationsDataProportioningService.updateLumiereFormulaSpecificationsDataProportioning(lumiereFormulaSpecificationsDataProportioning);
    }

    @ApiOperation("配方规格数据配比管理-删除配方规格数据配比")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "id"),
    })
    @LogAnno
    @DeleteMapping("/delete")
    public ResponseUtil.Response delete(Integer id)  {
        return adminLumiereFormulaSpecificationsDataProportioningService.deleteLumiereFormulaSpecificationsDataProportioning(id);
    }



}
